package com.xu.controller;

import org.junit.experimental.theories.DataPoints;

public abstract class BaseTester {
	private static final int businessMinInteger = 0;
	private static final int businessMaxInteger = 10;
	private static final int businessMinStringLength = 1;
	private static final int businessMaxStringLength = 12;
	private static final String SPECIAL_STRING  ="specialString";
	
	/**
	 * 正常值
	 */
	@DataPoints({ "normalInteger" })
	public static int[] getNormalIntegers() {
		final int size = businessMaxInteger - businessMinInteger + 1;
		int[] integerArray = new int[size];
		for (int i = 0; i < size; i++) {
			integerArray[i] = businessMinInteger + i;
		}
		return integerArray;
	}

	/**
	 * 溢出边界
	 */
	@DataPoints({ "limitInteger" })
	public static int[] getOverflowInteger() {
		return new int[] { businessMaxInteger + 1, businessMinInteger - 1 };
	}

	/**
	 * 临近边界
	 * 
	 * @return
	 */
	@DataPoints({ "limitInteger" })
	public static int[] getCriticalInteger() {
		return new int[] { businessMaxInteger - 1, businessMinInteger + 1 };
	}

	/**
	 * 极限值(integer max & min)
	 */
	@DataPoints({ "limitInteger" })
	public static int[] getLimitIntegers() {
		return new int[] { Integer.MIN_VALUE, Integer.MAX_VALUE };
	}

	/**
	 * 特殊字符字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getSpecialString() {
		return new String[] { "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".",
				"/", ":", ";", "<", "=", ">", "?", "@", "[", "\\", "]", "^", "_", "`", "{", "|", "}", "~" };
	}

	/**
	 * 英文字母字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getEnglishString() {
		return new String[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N",
				"O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i",
				"j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z" };
	}

	/**
	 * 数字字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getNumberString() {
		return new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
	}

	/**
	 * 空字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getBlankString() {
		return new String[] { " ", "	", "\r", "\n", "\t", "\b", "\f", "", null };
	}

	/**
	 * 中文字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getChineseString() {
		return new String[] { "中", "文", "字", "符", "串"};
	}
	
	/**
	 * 中文生僻字字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getChineseRareString() {
		return new String[] { "砼", "", "犇", "玮", "翀"};
	}
	
	/**
	 * 超过最大长度字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getOverMaxLengthString() {
		final StringBuffer specialString = new StringBuffer();
		for(int i = 0; i <= businessMaxStringLength;i++){
			specialString.append('-');
		}
		return new String[] { specialString.toString()};
	}
	
	/**
	 * 少于最短长度字符串
	 */
	@DataPoints({ SPECIAL_STRING })
	public static String[] getOverMinLengthString() {
		final StringBuffer specialString = new StringBuffer();
		for(int i = 0; i < businessMinStringLength -1;i++){
			specialString.append('-');
		}
		return new String[] { specialString.toString()};
	}
}
